<?php
namespace app\admin\controller;


use think\Controller;
use think\Db;

class Index extends Controller
{
    public function index()
    {
              $data=input('post.');


        $list = Db::name('admin')->field(['password', 'name'])->order('id', 'aes')->where('name',$data['name'])->select();
       if(!empty($list)){
           if ($data['password']==$list[0]['password']){
              return $this->fetch('index/index');
           }else{

              return $this->error('密码错误',url('admin/index/login'));
               //return view('login/login');
           }
       }else{
           //return  $this->error('名字错误',url('{/admin/index/}'));
           //return view('login/login');

  return $this->error('名字错误',url('admin/index/login'));
       }


     return $this->fetch('index/index');

    }

     public function login()
  {
    return $this->fetch('login/login');
   }
}
